package ATBMS.modles.DAO;

import ATBMS.modles.User;
import java.util.List;

/**
 * User DAO Interface
 */
public interface UserDAO {

    /**
     * put a User Object into database
     * @param user
     * @return succeed or failed
     */
    public boolean insert(User user);

    /**
     * Update a User Object
     * @param uid
     * @param user
     * @return succeed or failed
     */
    public boolean update(int uid, User user);

    /**
     * Delete a User Object
     * @param uid
     */
    public void delete(int uid);

    /**
     * Retrieve All Users
     * @return Tickect List
     */
    public List<User> findAll();

    /**
     * Retrieve  Users By Level
     * @param level
     * @return
     */
    public List<User> findByLevel(int level);

    /**
     * Find  User By id
     * @param level
     * @return User Object or null
     */
    public User findByPrimaryKey(int uid);

    /**
     * Find  User By name
     * @param name
     * @return User Object or null
     */
    public User findByName(String name);

    /**
     * Get Error Message
     * @return Error Message
     */
    public String getErrorMessage();

    /**
     * Check User name and password
     * @param user
     * @return User or null
     */
    public User validateUser(User user);
}
